<?php switch($content_type){
case 'pm_cm': ?>
<form id="pm-form" action="<?php echo $action_link; ?>" method="POST">
<dl class="cp-header">
    <dl>
        <?php if(!empty($to_member_list)){ ?>
        <dd class="to_member">
            <span><strong><?php echo $text_to; ?></strong></span>&nbsp;&nbsp;
            <?php foreach($to_member_list as $to_member){ ?>
            <span class="remove_to_member" ><?php echo $to_member; ?><input type="submit" name="remove_to_member" value="<?php echo $to_member; ?>">&nbsp;&nbsp;&nbsp;</span>
            <?php } ?>
        </dd>
        <?php } ?>
        <?php if(isset($error_to_member)){ ?>
        <dd><span class="error"><?php echo $error_to_member; ?></span></dd>
        <?php } ?>
        <dd id="pm-add-member"><?php echo $entry_add_member; ?>&nbsp;<input id="add_member_text" type="text" name="add_member" value="" /><input type="submit" class="input-buttons" name="add_member_submit" value="<?php  echo $text_add; ?>" </dd>
    </dl>
    <dl>
        <dd id="pm-subject">
        <?php echo $entry_subject ?><input type="text" name="subject" value="<?php echo $subject; ?>" />
        <?php if($error_subject){ ?>
            <span class="inline_error"><?php echo $error_subject; ?></span>
        <?php } ?>
        </dd>
    </dl>
</dl>
<dl class="gray-block">
    <?php if($bbcode_enable){ ?>
    <dt id="bb_code">
      <?php foreach($bb_buttons as $bb_button){ ?>
      <?php echo $bb_button; ?>
      <?php } ?>
    </dt>
    <?php } ?>
    <dd id="pm-textarea">
        <?php if($error_content){ ?>
        <span class="error"><?php echo $error_content; ?></span>
        <?php } ?>
        <textarea name="content" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onfocus="initInsertions();"><?php echo $content; ?></textarea>
    </dd>
    <?php if($smiles_enable){ ?>
    <dd id="ubb-smile" class="pm-smile">
        <span>Smilies</span>
        <?php echo $smiles; ?>
    </dd>
    <dd class="signature-enable-tip">
        <span>&bull;<?php echo $bbcode_enable ? $text_bbcode_enabled : $text_bbcode_disabled; ?></span>
        <span>&bull;<?php echo $bbcode_enable&&isset($bbcode_img_enable)&&$bbcode_img_enable ? $text_img_enabled : $text_img_disabled; ?></span>
        <span>&bull;<?php echo $bbcode_enable&&isset($bbcode_flash_enable)&&$bbcode_flash_enable ? $text_flash_enabled : $text_flash_disabled; ?></span>
        <span>&bull;<?php echo $bbcode_enable&&isset($bbcode_url_enable)&&$bbcode_url_enable ? $text_url_enabled : $text_url_disabled; ?></span>
        <span>&bull;<?php echo $smiles_enable ? $text_smile_enabled : $text_smile_disabled; ?></span>
    </dd>
    <?php } ?>
</dl>
<dl class="gray-block">
    <dd class="center-up"><input class="input-buttons" type="submit" name="send" value="<?php echo $text_send; ?>" /></dd>
</dl>
</form>
<script type="text/javascript"><!--
<?php if($bbcode_enable || $smiles_enable){ ?>
  var form_name = 'pm-form';
  var text_name = 'content';
<?php if($bbcode_enable){ ?>
  var bbcode = new Array();
  var bbtags = new Array(<?php echo implode(',',$bb_tags); ?>);
<?php } ?>
--></script>
<script type="text/javascript" src="catalog/view/javascript/editor.js"></script>
<?php } ?>
<?php if($bbcode_enable){ ?>
<div id="font_colour_palette" class="pm_font_colour_palette" style="display:none;">
<script type="text/javascript"><!--
   function change_palette(id){
        hideOrShow(id);
        e = document.getElementById(id);

        if (e.style.display == 'block'){
            document.getElementById('font_color').title = '<?php echo $text_font_color_close; ?>';
        }else{
            document.getElementById('font_color').title = '<?php echo $text_font_color; ?>';
        }
   }
   colorPalette('h', 15, 10);
--></script>
</div>
<?php } ?>
<?php  break; ?>
<?php case 'pm_ib': ?>
<!--view private message in list view-->
<?php if(!isset($has_mid)){ ?>
<form id="inbox-list-view" name="inbox-list-view" action="<?php echo $action_link; ?>" method="POST">
<dl class="cp-header pm-inbox-header">
    <dd><?php echo $text_inbox_folder_full; ?></dd>
    <dd id="newpm-button"><a href="<?php echo $newpm_link; ?>"></a></dd>
    <?php if($is_folder_full){ ?>
    <dd id="pm-folder-full"><?php echo $error_list_folder_full ; ?></dd>
    <?php } ?>
</dl>
<dl class="cp-list-heading2">
    <dd class="cp-list-heading2-left"><?php echo $text_message; ?></dd>
    <dd class="cp-list-heading2-right"><?php echo $text_mark; ?></dd>
</dl>
<?php if(!empty($inbox_pms)){ ?>
<?php foreach($inbox_pms as $inbox_pm){ ?>
<dl class="cp-list2">
    <dd class="cp-list2-left <?php echo $inbox_pm['message_read_status']; ?>">
        <span><a href="<?php echo $inbox_pm['msg_link']; ?>"><?php echo $inbox_pm['message_subject']; ?></a></span>
        <?php echo $inbox_pm['is_reported'] ? '&nbsp;<img style="vertical-align:middle;" src="catalog/view/theme/default/image/post/icon_topic_reported.gif" title="' . $text_pm_reported . '" />' : ''; ?>
        <br />
        <span><?php echo$text_by . '&nbsp;'; ?><a href="<?php echo $inbox_pm['user_profile_url']; ?>"><?php echo $inbox_pm['username']; ?></a><?php echo $text_separator; echo $inbox_pm['message_time']; ?></span>
    </dd>
    <dd class="cp-list2-right"><input type="checkbox" name="marked_msg_id[]" value="<?php echo$inbox_pm['msg_id'] ; ?>" /></dd>
</dl>
<?php } ?>
<?php }else{ ?>
    <span><strong><?php echo $text_no_messages; ?></strong></span>
<?php } ?>
<?php if($inbox_total>0){ ?>
<dl class="cp-list-bottom">
    <dd><?php if($inbox_total>1){ ?>
        &bull; <a href="#" onclick="marklist('inbox-list-view', 'marked_msg', true); return false;"><?php echo $text_mark_all; ?></a>
        &bull; <a href="#" onclick="marklist('inbox-list-view', 'marked_msg', false); return false;"><?php echo $text_unmark_all; ?></a>
        <?php } ?>
        <input class="input-buttons" type="submit" name="delete_pm" value="<?php echo $text_delete; ?>" onclick="{if(confirm('<?php echo $text_confirm_delete; ?>')){this.document.inbox-list-view.submit();return true;}return false;}" />
    </dd>
</dl>
<div class="forum-pagination"><?php echo $pagination; ?></div>
<?php } ?>
</form>
<script type="text/javascript"><!--
$(document).ready(
    function(){
        $(".inbox-list").filter(":even").mouseover(function() {
            $(this).css("background-color", "#FFFFDB");
        }).mouseout(function(){
                $(this).css("background-color", "");
            });

        $(".inbox-list").filter(":odd").mouseover(function() {
            $(this).css("background-color", "#FFFFDB");
        }).mouseout(function(){
                $(this).css("background-color", "");
            });
    });
//--></script>
<!--view private messages details-->
<?php }else{ ?>
<form name="inbox-detail-view" action="<?php echo $action_link; ?>" method="POST">
<dl class="cp-header pm-inbox-header">
    <dd><?php echo $text_inbox_folder_full; ?></dd>
    <dd id="view-message-reply-button"><a href="<?php echo $reply_pm_link; ?>"></a></dd>
    <?php if($is_folder_full){ ?>
    <dd id="pm-folder-full"><?php echo $error_folder_full; ?></dd>
    <?php } ?>
</dl>
<dl class="view-message">
    <dl class="view-message-header">
        <dd class="view-message-subject"><?php echo $private_message['message_subject']; ?></dd>
        <dd>
            <input class="delete-icon" type="submit" name="delete_pm" title="<?php echo $text_delete_pm; ?>" onclick="{if(confirm('<?php echo $text_confirm_delete; ?>')){this.document.inbox-detail-view.submit();return true;}return false;}" />
            <?php if($show_report_icon){ ?>
            <a class="report-icon" href="<?php echo $private_message['report_link']; ?>" title="<?php echo $text_report_pm; ?>"></a>
            <?php } ?>
        </dd>
        <dd class="view-message-subtitle"><span><strong><?php echo $text_from; ?></strong>&nbsp;</span><a href="<?php echo $private_message['user_profile_url']; ?>"><?php echo $private_message['username']; ?></a>&nbsp;&raquo;&nbsp;<span><strong><?php echo $text_sent; ?></strong>&nbsp;<?php echo $private_message['message_time']; ?></span></dd>
    </dl>
    <dl>
        <dd><?php echo $private_message['message_text']; ?></dd>
    </dl>
</dl>
<?php if($has_message_history){ ?>
<dl id="view-message-history">
    <dd id="view-message-history-header"><?php echo $text_message_history; ?></dd>
    <dd id="view-message-history-scroll">
        <?php foreach($private_message_histories as $private_message_history){ ?>
        <dl class="view-message">
            <dl class="view-message-header">
                <dd class="view-message-subject"><?php echo $private_message_history['message_subject']; ?></dd>
                <dd class="view-message-subtitle"><span><strong><?php echo $text_by; ?></strong>&nbsp;</span><a href="<?php echo $private_message_history['user_profile_url']; ?>"><?php echo $private_message_history['username']; ?></a>&nbsp;&raquo;&nbsp;<span><strong><?php echo $text_sent; ?></strong>&nbsp;<?php echo $private_message_history['message_time']; ?></span></dd>
            </dl>
            <dl>
                <dd><?php echo $private_message_history['message_text']; ?></dd>
            </dl>
        </dl>
        <?php } ?>
    </dd>
</dl>
<?php } ?>
</form>
<?php } ?>
<?php break; ?>
<?php case 'pm_sm': ?>
<!--view sent message in list view-->
<?php if(!isset($has_mid)){ ?>
<form id="sent-message-list-view" name="sent-message-list-view" action="<?php echo $action_link; ?>" method="POST">
    <dl class="cp-header pm-inbox-header">
        <dd><?php echo $text_sent_messages_folder_full; ?></dd>
        <dd id="newpm-button"><a href="<?php echo $newpm_link; ?>"></a></dd>
        <?php if($is_folder_full){ ?>
        <dd id="pm-folder-full"><?php echo $error_list_folder_full; ?></dd>
        <?php } ?>
    </dl>
    <dl class="cp-list-heading2">
        <dd class="cp-list-heading2-left"><?php echo $text_message; ?></dd>
        <dd class="cp-list-heading2-right"><?php echo $text_mark; ?></dd>
    </dl>
    <?php if(!empty($sent_messages)){ ?>
    <?php foreach($sent_messages as $sent_message){ ?>
        <dl class="cp-list2">
            <dd class="cp-list2-left sent-message-list-left">
                <a href="<?php echo $sent_message['msg_link']; ?>"><span><?php echo $sent_message['message_subject']; ?></span></a>
                <?php echo $sent_message['is_reported'] ? '&nbsp;<img style="vertical-align:middle;" src="catalog/view/theme/default/image/post/icon_topic_reported.gif" title="' . $text_pm_reported . '" />' : ''; ?>
                <br />
                <span>
                    <?php echo$text_to . '&nbsp;'; ?>
                    <?php $u=0; ?>
                    <?php  foreach($sent_message['usernames'] as $userName){ ?>
                    <a href="<?php echo $sent_message['user_profile_urls'][$u]; ?>"><?php echo $userName; ?></a>&nbsp;
                    <?php $u++; ?>
                    <?php } ?>
                    <?php echo $text_separator; echo $sent_message['message_time']; ?>
                </span>
            </dd>
            <dd class="cp-list2-right"><input type="checkbox" name="marked_msg_id[]" value="<?php echo $sent_message['msg_id']; ?>" /></dd>
        </dl>
        <?php } ?>
    <?php }else{ ?>
    <span><strong><?php echo $text_no_messages; ?></strong></span>
    <?php } ?>
    <?php if($sent_message_total>0){ ?>
    <dl class="cp-list-bottom">
        <dd><?php if($sent_message_total>1){ ?>
            &bull; <a href="#" onclick="marklist('sent-message-list-view', 'marked_msg', true); return false;"><?php echo $text_mark_all; ?></a>
            &bull; <a href="#" onclick="marklist('sent-message-list-view', 'marked_msg', false); return false;"><?php echo $text_unmark_all; ?></a>
            <?php } ?>
            <input class="input-buttons" type="submit" name="delete_sm" value="<?php echo $text_delete; ?>" onclick="{if(confirm('<?php echo $text_confirm_delete; ?>')){this.document.sent-message-list-view.submit();return true;}return false;}" />
        </dd>
    </dl>
    <div class="forum-pagination"><?php echo $pagination; ?></div>
    <?php } ?>
</form>
<script type="text/javascript"><!--
$(document).ready(
    function(){
        $(".sent-message-list").filter(":even").mouseover(function() {
            $(this).css("background-color", "#FFFFDB");
        }).mouseout(function(){
                $(this).css("background-color", "");
            });

        $(".sent-message-list").filter(":odd").mouseover(function() {
            $(this).css("background-color", "#FFFFDB");
        }).mouseout(function(){
                $(this).css("background-color", "");
            });
    });
//--></script>
<!--view sent messages details-->
<?php }else{ ?>
<form name="sent-message-detail-view" action="<?php echo $action_link; ?>" method="POST">
    <dl class="cp-header pm-inbox-header">
        <dd><?php echo $text_sent_messages_folder_full; ?></dd>
        <?php if($is_folder_full){ ?>
        <dd id="pm-folder-full"><?php echo $error_folder_full; ?></dd>
        <?php } ?>
    </dl>
    <dl class="view-message">
        <dl class="view-message-header">
            <dd class="view-message-subject"><?php echo $sent_message['message_subject']; ?></dd>
            <dd>
                <input class="delete-icon" type="submit" name="delete_pm" title="<?php echo $text_delete_pm; ?>" onclick="{if(confirm('<?php echo $text_confirm_delete; ?>')){this.document.sent-message-detail-view.submit();return true;}return false;}" />
                <?php if($show_report_icon){ ?>
                <a class="report-icon" href="<?php echo $sent_message['report_link']; ?>" title="<?php echo $text_report_pm; ?>"></a>
                <?php } ?>
            <dd class="view-message-subtitle">
                <span><strong><?php echo $text_to; ?></strong>&nbsp;</span>
                <?php $u=0; ?>
                <?php  foreach($sent_message['usernames'] as $userName){ ?>
                <a href="<?php echo $sent_message['user_profile_urls'][$u]; ?>"><?php echo $userName; ?></a>&nbsp;
                <?php $u++; ?>
                <?php } ?>&nbsp;&raquo;&nbsp;
                <span><strong>Sent:</strong>&nbsp;<?php echo $sent_message['message_time']; ?></span>
            </dd>
        </dl>
        <dl>
            <dd><?php echo $sent_message['message_text']; ?></dd>
        </dl>
    </dl>
    <?php if($has_message_history){ ?>
    <dl id="view-message-history">
        <dd id="view-message-history-header"><?php echo $text_message_history; ?></dd>
        <dd id="view-message-history-scroll">
            <?php foreach($sent_message_histories as $sent_message_history){ ?>
            <dl class="view-message">
                <dl class="view-message-header">
                    <dd class="view-message-subject"><?php echo $sent_message_history['message_subject']; ?></dd>
                    <dd class="view-message-subtitle"><span><strong>By:</strong>&nbsp;</span><a href="<?php echo $sent_message_history['user_profile_url']; ?>"><?php echo $sent_message_history['username']; ?></a>&nbsp;&raquo;&nbsp;<span><strong>Sent:</strong>&nbsp;<?php echo $sent_message_history['message_time']; ?></span></dd>
                </dl>
                <dl>
                    <dd><?php echo $sent_message_history['message_text']; ?></dd>
                </dl>
            </dl>
            <?php } ?>
        </dd>
    </dl>
    <?php } ?>
</form>
<?php } ?>
<?php  break; ?>
<?php } ?>